package org.jim.connector.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * @FileName:
 * @Description:
 * @Author linjie
 * @Date 2020/7/1511:19 AM
 * @Version 4.0.0
 */
@Data
@ConfigurationProperties(prefix = "jim")
public class JimProperties {

    private String bindIp = "127.0.0.1";

    private Integer port = 8888;
    /**
     * 心跳超时时长
     **/
    private Integer heartbeatTimeout = 0;
    /**
     * 是否开启消息持久化(on:开启,off:不开启)
     */
    private String store = "off";
    /**
     * 是否开启集群(on:开启,off:不开启)
     **/
    private String cluster = "off";
    /**
     * 是否开启SSL(on:开启,off:不开启)
     **/
    private String ssl = "off";
    /**
     * #JKS证书地址
     **/
    private String keyStorePath = "classpath:ssl/keystore.jks";
    /**
     * #JKS证书密码
     */
    private String keyStorePwd = "214323428310224";

    @Data
    private static class Http {
        /**
         * #html/css/js等的根目录，支持classpath:也支持绝对路径
         **/
        private String page = "pages";
        /**
         * #http mvc扫描包路径
         */
        private String scanPackages = "org.jim.connector.server.ImServerStart";
        /**
         * #http资源缓存时长
         **/
        private Integer maxLiveTime = 0;
    }


    @Data
    private static class Redis {
        /**
         * #连接池连接不够用时,重试获取连接次数
         **/
        private Integer retrynum = 100;
        /**
         * #可用连接实例的最大数目，默认值为8；
         */
        private Integer maxactive = -1;
        /**
         * #控制一个pool最多有多少个状态为idle(空闲的)的jedis实例，默认值也是8。
         **/
        private Integer maxidle = 20;
        /**
         * #等待可用连接的最大时间，单位毫秒，默认值为-1，表示永不超时。
         **/
        private Integer maxwait;

        private Integer timeout;
        /**
         * #redis所在机器ip
         **/
        private String host = "127.0.0.1";

        private Integer port = 6379;

        private String auth;
    }
}
